from django.contrib import admin
from django.urls import path
from django.conf import settings
from django.conf.urls.static import static

import accounts.views as accounts_views
import social.views as social_views
import music.views as music_views
import movies.views as movies_views

urlpatterns = [
    path('admin/', admin.site.urls),
    # 实现登录
    path('', accounts_views.loadindex, name='MyLife-index'),
    path('login/', accounts_views.login, name='login'),
    path('logout/', accounts_views.logout),
    path('image/code/', accounts_views.image_code),
    # 注册
    path('register/', accounts_views.register),
    # 社交板块
    path('social/<str:username>/', social_views.home, name='user_home'),
    path('social/love/', social_views.love),
    path('social/edit/<str:username>/', social_views.edit, name='edit_profile'),
    path('social/friendmanage/<str:username>/',
         social_views.friend_management, name='manage_profile'),
    path('delete_friend/<str:friend_username>/<str:current_username>/',
         social_views.delete_friend, name='delete_friend'),
    path('social/friendadd/<str:username>/',
         social_views.friendadd, name='add_profile'),
    path('send_friend_request/<str:friend_username>/<str:current_username>/',
         social_views.send_friend_request, name='send_friend_request'),
    path('like_user/<str:user_name>/<str:friend_name>/',
         social_views.like_user, name='like_user'),
    path('huizan/<str:user_name>/<str:friend_name>/',
         social_views.huizan, name='huizan'),
    path('view_likes/<str:username>/',
         social_views.view_likes, name='view_likes'),
    path('friend_messages/<str:username>/',
         social_views.friend_messages, name='friend_messages'),
    path('leave_message/<str:sender_username>/<str:receiver_username>/',
         social_views.leave_message, name='leave_message'),
    path('huifu/<str:sender_username>/<str:receiver_username>/',
         social_views.huifu, name='huifu'),
    path('create_post/<str:username>/',
         social_views.create_post, name='create_post'),
    path('view_posts/<str:username>/',
         social_views.view_posts, name='view_posts'),
    path('my_posts/<str:username>/', social_views.my_posts, name='my_posts'),
    path('logout/', social_views.logout_user, name='logout_user'),



    # 电影推荐部分
    path('movies/search/', movies_views.movies_search, name='movies_search'),
    path('get-tag-options/', movies_views.get_tag_options, name='get_tag_options'),
    path('movies/results/', movies_views.movies_results, name='movies_results'),
    path('movies/details/<int:movie_id>/',
         movies_views.movies_details, name='movies_details'),
    path('movies/recommendations/<int:user_id>',
         movies_views.recommend_for_user, name='movies_recommendations'),
    
    # 音乐推荐部分
    path('music/index/',
         music_views.index, name='music_index'),
    path('music/detail/<int:music_id>/',
         music_views.detail, name='music_detail'),
    path('music/list/<int:category_id>/',
         music_views.list_by_category, name='music_list_category'),
    path('music/like/add/', music_views.add_like, name='add_music_like'),
    path('music/likes/', music_views.view_my_likes, name='view_my_likes'),
    path('music/like/delete/', music_views.delete_like, name='delete_music_like'),
    path('music/top/', music_views.view_top_music, name='view_top_music'),
    path('music/comment/add/', music_views.add_comment, name='add_music_comment'),
    path('music/recommendations/<int:user_id>/',
         music_views.recommend_for_user, name='user_music_recommendations'),
    path('music/score/input/', music_views.input_music_score,
         name='input_music_score'),
]+static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
